Carbon


CatMove

Header: Files.h Carbon status: Supported

Moves files or directories from one directory to another on the same volume.

OSErr CatMove (
    SInt16 vRefNum, 
    SInt32 dirID, 
    ConstStr255Param oldName, 
    SInt32 newDirID, 
    ConstStr255Param newName
);
vRefNum

A volume reference number, a working directory reference number, or 0 for the default volume.

dirID

A directory ID.

oldName

An existing filename or directory name.

newDirID

If newName is empty, the directory ID of the target directory; otherwise, the parent directory ID of the target directory.

newName

The name of the directory to which the file or directory is to be moved. If a valid directory name is provided for newName, the destination directory’s parent directory is specified in newDirID. However, you can specify an empty name for newName, in which case newDirID should be set to the directory ID of the destination directory.

It is usually simplest to specify the destination directory by passing its directory ID in the newDirID parameter and by setting newName to an empty name. To specify an empty name, set newName to ':'.

function result

A result code.

DISCUSSION

CatMove is strictly a file catalog operation; it does not actually change the location of the file or directory on the disk.

The CatMove function cannot move a file or directory to another volume (that is, the vRefNum parameter is used in specifying both the source and the destination). Also, you cannot use it to rename files or directories; to rename a file or directory, use HRename.

AVAILABILITY

Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.


© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)